// 导入mysql模块 用于连接和操作mysql
const {Sequelize, Op, Model, DataTypes} = require('sequelize')

let seq = null 
if(!seq) {
    seq = new Sequelize('yuneban', 'root', '123456', {
        host: '8.142.104.99',
        dialect: 'mysql',
        pool: {
            max: 5,
            min: 1,
            acquire: 30000,
            idel: 10000
        }
    })
    
    seq.authenticate().then((resp) => {
        console.log('mysql connected', resp)
    }).catch(err => {
        console.log('mysql connect failed', err)
    })
}


// 导出 
module.exports = {
    seq,
    Sequelize,
    Op,
    Model,
    DataTypes
}  
